export function Alarm_option (data, total) {
  return {
    grid: {
      left: "5%",
      right: "15%",
      bottom: "2%",
      containLabel: true,
    },
    title: {
      left: 'center',
      // top: 'center',
      show: true,
      text: total,
      padding: [75, 5, 5, 75],
      textStyle: {
        color: '#ffffff',
        fontSize: 40,
        fontFamily: 'DIN Alternate, DIN Alternate-Bold'
      },
      subtext: '告 警 总 数',
      subtextStyle: {
        show: true,
        fontSize: 16,
        color: '#ffffff'
      }
    },
    series: [
      {
        name: data.length === 3 ? '告警来源' : '告警等级',
        type: 'pie',
        radius: ['80%', '87%'],
        avoidLabelOverlap: false,
        padAngle: 5,
        itemStyle: {
          borderRadius: 10
        },
        label: {
          show: false
          // position: 'center',
        },
        emphasis: {
          disabled: true
        },
        labelLine: {
          show: false
        },
        data: [
          {
            name: data.length === 3 ? '动环告警' : '一级',
            value: data[0],
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: '#FDEAA7'
                  },
                  {
                    offset: 0,
                    color: '#FFFA6A'
                  }
                ]
              }
            }
          },
          {
            name: data.length === 3 ? '故障告警' : '二级',
            value: data[1],
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: '#8BCAE7'
                  },
                  {
                    offset: 0,
                    color: '#F0FEFF'
                  }
                ]
              }
            }
          },
          {
            name: data.length === 3 ? 'U位告警' : '三级',
            value: data[2],
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: '#ADFFFC'
                  },
                  {
                    offset: 0,
                    color: '#0BE8EB'
                  }
                ]
              }
            }
          },
          {
            name: '四级',
            value: data[3],
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: '#2999E7'
                  },
                  {
                    offset: 0,
                    color: '#FDFDFD'
                  }
                ]
              }
            }

          },
        ]
      }
    ]
  }
}